ÙSoundContentsFigures, Tables, and ListingsAbout This BookFormat of a Typical ChapterConventions Used in This Book
Special FontsTypes of NotesAssembly-Language InformationDevelopment Environment
For More Information&Introduction to Sound on the Macintosh"About Sound on Macintosh ComputersSound Capabilities:Figure 1-1 Basic sound capabilities on Macintosh computers=Figure 1-2 Enhanced sound capabilities on Macintosh computersAFigure 1-3 High quality sound capabilities on Macintosh computers"Figure 1-4 A sound component chain3Figure 1-5 A sound component chain with a DSP boardSound Production&Figure 1-6 The Sound Out control panelBFigure 1-7 The relation of the Sound Manager to the audio hardware&Figure 1-8 Bypassing the command queue4Figure 1-9 Mixing multiple channels of sampled soundSound Recording&Figure 1-10 The Sound In control panel*Figure 1-11 The Alert Sounds control panel*Figure 1-12 The sound recording dialog boxSound ResourcesSound Files &Table 1-1 AIFF and AIFF-C capabilitiesSpeech Generation)Figure 1-13 The speech generation process2Figure 1-14 The Speech Manager and multiple voicesThe User Interface for Sound&Figure 1-15 An icon for a Finder sound$Figure 1-16 A sound in the Scrapbook"Using Sound on Macintosh ComputersProducing an Alert SoundPlaying a Sound Resource1Listing 1-1 Playing a sound resource with SndPlayPlaying a Sound File 6Listing 1-2 Playing a sound file with SndStartFilePlay&Checking For Sound-Recording EquipmentFListing 1-3 Determining whether sound recording equipment is availableRecording a Sound Resource<Listing 1-4 Recording through the sound recording dialog box&Listing 1-5 Recording a sound resourceRecording a Sound File"Listing 1-6 Recording a sound file Checking For Speech Capabilities7Listing 1-7 Checking for speech generation capabilitiesGenerating Speech From a String>Listing 1-8 Using SpeakString to generate speech from a string+Listing 1-9 Generating speech synchronously5Listing 1-10 Stopping speech generated by SpeakStringSound ReferenceRoutinesPlaying SoundsSysBeepSndPlaySndStartFilePlayRecording Sounds SndRecordSndRecordToFileGenerating and Stopping SpeechSpeakString
SpeechBusy
Summary of Sound
Sound Manager
About the Sound Manager,Figure 2-1 The position of the Sound Manager
Sound DataSquare-Wave DataWave-Table Data"Figure 2-2 A graph of a wave tableSampled-Sound Data,Figure 2-3 Interleaving stereo sample pointsSound CommandsSound ChannelsSound Compression and ExpansionTable 2-1 Sample ratesUsing the Sound ManagerManaging Sound ChannelsAllocating Sound Channels$Listing 2-1 Creating a sound channelInitializing Sound Channels*Listing 2-2 Reinitializing a sound channelReleasing Sound Channels?Listing 2-3 Disposing of memory associated with a sound channel$Manipulating a Sound That Is Playing4Listing 2-4 Halving the frequency of a sampled sound5Listing 2-5 Changing the amplitude of a sound channel8Listing 2-6 Getting the amplitude of a sound in progressStopping Sound Channels%Pausing and Restarting Sound ChannelsSynchronizing Sound ChannelsFListing 2-7 Adding a channel to a group of channels to be synchronizedManaging Sound Volumes*Listing 2-8 Setting left and right volumes#Obtaining Sound-Related Information4Obtaining Information About Available Sound Features9Listing 2-9 Determining if stereo capability is availableObtaining Version InformationAListing 2-10 Determining if the enhanced Sound Manager is present>Testing for Multichannel Sound and Play-From-Disk Capabilities5Listing 2-11 Testing for multichannel play capability2Listing 2-12 Testing for play-from-disk capability2Obtaining Information About a Single Sound Channel:Listing 2-13 Determining whether a sound channel is paused.Obtaining Information About All Sound Channels?Listing 2-14 Determining the number of allocated sound channels=Determining and Changing the Status of the System Alert Sound
Playing Notes.Listing 2-15 Using the freqDurationCmd command3Table 2-2 Frequencies expressed as MIDI note values"Installing Voices Into Channels ?Listing 2-16 Installing a sampled sound as a voice in a channelLooping a Sound Indefinitely,Listing 2-17 Looping an entire sampled soundPlaying Sounds Asynchronously Using Callback Procedures'Listing 2-18 Issuing a callback command*Listing 2-19 Defining a callback procedure?Listing 2-20 Checking whether a callback procedure has executed<Listing 2-21 Stopping a sound that is playing asynchronously0Listing 2-22 Starting an asynchronous sound play&Synchronizing Sound With Other Actions'Managing an Asynchronous Play From Disk*Listing 2-23 Defining a completion routinePlaying Selections Managing Multiple Sound ChannelsCListing 2-24 Defining a data structure to track many sound channels+Listing 2-25 Marking a channel for disposalEListing 2-26 Disposing of channels that have been marked for disposal'Parsing Sound Resources and Sound Files%Obtaining a Pointer to a Sound Header%Listing 2-27 Playing a sound resource<Listing 2-28 Obtaining the offset in bytes to a sound headerTListing 2-29 Converting an offset to a sound header into a pointer to a sound header'Playing Sounds Using Low-Level Routines8Listing 2-30 Playing a sound using the bufferCmd commandFinding a Chunk in a Sound File,Listing 2-31 Finding a chunk in a sound file.Listing 2-32 Loading a chunk from a sound file Compressing and Expanding Sounds#Listing 2-33 Compressing audio dataUsing Double BuffersSetting Up Double Buffers&Listing 2-34 Setting up double buffersWriting a Doubleback Procedure,Listing 2-35 Defining a doubleback procedureSound Storage FormatsSound Resources,Figure 2-4 The structure of 'snd ' resources.Figure 2-5 The location of the data offset bitThe Format 1 Sound Resource'Listing 2-36 A format 1 'snd ' resourceFListing 2-37 A format 1 'snd ' resource containing sampled-sound data@Listing 2-38 An 'snd ' resource containing compressed sound data%Listing 2-39 A resource specification9Listing 2-40 A resource specification for the Simple BeepThe Format 2 Sound Resource 'Listing 2-41 A format 2 'snd ' resourceSound Files!Chunk Organization and Data Types+Figure 2-6 The general structure of a chunkThe Form ChunkThe Format Version ChunkThe Common ChunkThe Sound Data ChunkFormat of Entire Sound FilesFigure 2-7 A sample AIFF-C fileSound Manager Reference Constants"Gestalt Selector and Response Bits!Channel Initialization ParametersSound Command Numbers Chunk IDsData StructuresSound Command RecordsAudio Selection RecordsSound Channel Status RecordsSound Manager Status RecordsSound Channel RecordsSound Header RecordsExtended Sound Header RecordsCompressed Sound Header Records"Sound Double Buffer Header RecordsSound Double Buffer Records
Chunk HeadersForm ChunksFormat Version Chunks
Common ChunksExtended Common ChunksSound Data Chunks Version RecordsLeftover BlocksState BlocksSound Manager RoutinesPlaying Sound ResourcesSysBeepSndPlayPlaying From DiskSndStartFilePlaySndPauseFilePlaySndStopFilePlay'Allocating and Releasing Sound Channels
SndNewChannelSndDisposeChannel #Sending Commands to a Sound ChannelSndDoCommandSndDoImmediateObtaining InformationSndSoundManagerVersionMACEVersion
SndControlSndChannelStatusSndManagerStatusSndGetSysBeepStateSndSetSysBeepStateGetSoundHeaderOffsetControlling Volume LevelsGetSysBeepVolumeSetSysBeepVolumeGetDefaultOutputVolumeSetDefaultOutputVolume$Compressing and Expanding Audio DataComp3to1Comp6to1Exp1to3Exp1to6Managing Double BuffersSndPlayDoubleBuffer*Performing Unsigned Fixed-Point ArithmeticUnsignedFixMulDiv#Linking Modifiers to Sound ChannelsSndAddModifierApplication-Defined RoutinesCompletion RoutinesMyCompletionRoutineCallback Procedures MyCallbackProcedureDoubleback ProceduresMyDoubleBackProc ResourcesThe Sound Resource#Figure 2-8 The 'snd ' resource type$Figure 2-9 The sound resource header
Summary of the Sound ManagerSound Input ManagerAbout the Sound Input Manager.Sound Recording Without the Standard Interface$Interaction With Sound Input DevicesSound Input Device DriversUsing the Sound Input Manager'Recording Sounds Directly From a Device8Listing 3-1 Recording directly from a sound input device)Defining a Sound Input Completion Routine(Defining a Sound Input Interrupt Routine2Getting and Setting Sound Input Device Information8Listing 3-2 Determining the name of a sound input device8Listing 3-3 Determining some sound input device settings#Writing a Sound Input Device Driver)Responding to Status and Control Requests?Figure 3-1 An example of the csParam field for a Status request@Figure 3-2 An example of the csParam field for a Control requestResponding to Read RequestsSupporting Stereo RecordingSupporting Continuous RecordingSound Input Manager Reference Constants"Gestalt Selector and Response Bits(Sound Input Device Information SelectorsData StructuresSound Input Parameter BlocksSound Input Manager RoutinesRecording Sounds SndRecordSndRecordToFile'Opening and Closing Sound Input Devices
SPBOpenDeviceSPBCloseDevice 2Recording Sounds Directly From Sound Input Devices SPBRecordSPBRecordToFileSPBPauseRecordingSPBResumeRecordingSPBStopRecordingSPBGetRecordingStatusManipulating Device SettingsSPBGetDeviceInfoSPBSetDeviceInfo,Constructing Sound Resource and File HeadersSetupSndHeader@Table 3-1 The sampled sound header format used by SetupSndHeaderSetupAIFFHeaderRegistering Sound Input DevicesSPBSignInDeviceSPBGetIndexedDeviceSPBSignOutDevice)Converting Between Milliseconds and BytesSPBMilliSecondsToBytesSPBBytesToMilliSecondsObtaining Information
Summary of the Sound Input ManagerSpeech ManagerAbout the Speech Manager(Figure 4-1 The speech generation processVoices1Figure 4-2 The Speech Manager and multiple voicesSpeech Attributes8Figure 4-3 MIDI note values and corresponding piano keys1Figure 4-4 An example of pitch range for a voice Speech ChannelsCallback Routines
Using the Speech Manager(Checking for Speech Manager Capabilities7Listing 4-1 Checking for speech generation capabilities2Creating, Using, and Disposing of a Speech Channel/Listing 4-2 Speaking text with a speech channelWorking With Different Voices,Listing 4-3 Getting a description of a voiceAdjusting Speech Attributes.Listing 4-4 Changing the speech rate and pitchPausing Speech4Listing 4-5 Pausing and continuing speech production Implementing Callback Procedures5Listing 4-6 Setting up a speech channel for callbacks0Listing 4-7 Installing a word callback procedure-Listing 4-8 A typical word callback procedure Writing Embedded Speech CommandsEmbedded Command Delimiters"Syntax of Embedded Speech Commands/Table 4-1 The embedded command syntax structure"Table 4-2 Embedded speech commands$Examples of Embedded Speech Commands!Phonemic Representation of SpeechPhonemic Symbols*Table 4-3 American English phoneme symbolsProsodic Control Symbols"Table 4-4 Prosodic control symbolsFTable 4-5 Effect of punctuation marks on English-language synthesizers%Including Pronunciation Dictionaries PListing 4-9 Installing a pronunciation dictionary resource into a speech channel7Listing 4-10 A sample pronunciation dictionary resourceSpeech Manager Reference ConstantsSpeech Information SelectorsData StructuresVoice Specification RecordsVoice Description RecordsVoice File Information Records!Speech Status Information Records Speech Error Information Records"Speech Version Information RecordsPhoneme Information RecordsPhoneme Descriptor RecordsSpeech Extension Data RecordsDelimiter Information RecordsSpeech Manager Routines&Starting, Stopping, and Pausing SpeechSpeakString SpeakTextSpeakBuffer
StopSpeechStopSpeechAt
PauseSpeechAtContinueSpeech"Obtaining Information About Voices
MakeVoiceSpecCountVoicesGetIndVoiceGetVoiceDescriptionGetVoiceInfoManaging Speech ChannelsNewSpeechChannelDisposeSpeechChannel"Obtaining Information About SpeechSpeechManagerVersion
SetSpeechInfoConverting Text To PhonemesTextToPhonemes%Installing a Pronunciation Dictionary
UseDictionaryApplication-Defined RoutinesText-Done Callback ProcedureMyTextDoneCallbackSpeech-Done Callback ProcedureMySpeechDoneCallback"Synchronization Callback ProcedureMySynchronizationCallbackError Callback ProcedureMyErrorCallbackPhoneme Callback ProcedureMyPhonemeCallbackWord Callback ProcedureMyWordCallback Resources%The Pronunciation Dictionary Resource8Figure 4-5 Format of a pronunciation dictionary resource@Figure 4-6 Format of a dictionary entry in a dictionary resource-Figure 4-7 Format of a dictionary entry field
Summary of the Speech ManagerSound ComponentsAbout Sound ComponentsSound Component Chains1Figure 5-1 The component-based sound architectureMFigure 5-2 A component chain for audio hardware that can convert sample ratesThe Apple Mixer,Figure 5-3 Mixing multiple channels of soundFFigure 5-4 A sound output device component that can mix sound channelsThe Data StreamWriting a Sound ComponentCreating a Sound Component.Listing 5-1 Rez input for a component resource'Specifying Sound Component Capabilities/Dispatching to Sound Component-Defined Routines0Listing 5-2 Handling Component Manager selectors>Listing 5-3 Finding the address of a component-defined routine)Registering and Opening a Sound Component)Listing 5-4 Initializing an output device+Finding and Changing Component Capabilities/Listing 5-5 Getting sound component information
Sound Components Reference Constants%Sound Component Information SelectorsAudio Data TypesSound Component Features FlagsAction FlagsData Format FlagsData StructuresSound Component Data RecordsSound Parameter BlocksSound Information ListsCompression Information RecordsSound Manager Utilities-Opening and Closing the Apple Mixer ComponentOpenMixerSoundComponentCloseMixerSoundComponent0Saving and Restoring Sound Component PreferencesSetSoundPreferenceGetSoundPreference Sound Component-Defined RoutinesManaging Sound ComponentsSoundComponentInitOutputDeviceSoundComponentSetSourceSoundComponentGetSourceSoundComponentGetSourceDataSoundComponentSetOutput#Creating and Removing Audio SourcesSoundComponentAddSourceSoundComponentRemoveSource/Getting and Setting Sound Component InformationSoundComponentGetInfoSoundComponentSetInfoManaging Source DataSoundComponentStartSourceSoundComponentStopSourceSoundComponentPauseSourceSoundComponentPlaySourceBuffer
Summary of Sound ComponentsAudio ComponentsAbout Audio Components+Figure 6-1 The Apple AudioVision 14 DisplayIFigure 6-2 The Volumes control panel for the Apple AudioVision 14 DisplayWriting an Audio ComponentCreating an Audio Component/Dispatching to Audio Component-Defined RoutinesAudio Components ReferenceData StructuresAudio Information Records Audio Component-Defined RoutinesGetting and Setting VolumesAudioGetVolumeAudioSetVolumeManaging the Mute StateAudioGetMuteAudioSetMuteResetting Audio ComponentsAudioSetToDefaults#Getting Audio Component InformationAudioGetInfo